<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<title>更新心得页面</title>






<link type="text/css" rel="stylesheet"
	href="<%=basePath%>css/resources/css/ext-all.css">




<script type="text/javascript" src="<%=basePath%>js/ext-base.js"></script>
<script type="text/javascript" src="<%=basePath%>js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="states.js"></script>
<script type="text/javascript" src="<%=basePath%>js/ext-all.js"></script>
<script type="text/javascript" src="<%=basePath%>js/StarHtmleditor.js"></script>

<script type="text/javascript" defer="defer">
			
			
			$(function(){
				$.getJSON(
				"/ICSS/appercetion",{action:"updateRequest",appercetionID:$("#appercetionID").val()}
				,function(data){
				
				
				var store = new Ext.data.ArrayStore({
        fields: ['value', 'state'],
        data : Ext.exampledata.states // from states.js
    });
    
 
					var top = new Ext.FormPanel({
        labelAlign: 'top',
        frame:true,
        title: '编辑心得',
        bodyStyle:'padding:5px 5px 0',
        onSubmit: Ext.emptyFn,
        submit: function(){
        	this.getEl().dom.action='/ICSS/appercetion?action=update';
        	this.getEl().dom.method='post';
        	this.getEl().dom.submit();
        },
        items: [{
            layout:'column',
            items:[{
                columnWidth:1,
                layout: 'form',
                items: [{
                    xtype:'textfield',
                    fieldLabel: '心得标题',
                    name: 'appercetionTitle',
                    id: 'appercetionTitle',
                    allowBlank: false,
                    value: data.appercetionTitle,
                    blankText: '心得标题不能为空',
                    anchor:'95%'
                }]
            }]
        },{
            xtype:'StarHtmleditor',
            fieldLabel:'心得记录',
            allowBlank: false,
            blankText: '心得记录不能为空',
            height:300,
            value: data.appercetionBody,
            name: 'appercetionBody',
			id: 'appercetionBody',
            anchor:'98%'
        },{
        xtype: 'combo',
        fieldLabel: '状态',
        store: store,
        displayField:'state',
        valueField: 'value',
        typeAhead: true,
        mode: 'local',
        forceSelection: true,
        triggerAction: 'all',
        selectOnFocus:true,
        editable: false,
        hiddenName: 'visiable',
        value: data.visiable,
        trrigerAction: 'all'
       
        },{
             xtype:'hidden',
             name: 'appercetionID',
             value: data.appercetionId
          
                },{
             xtype:'hidden',
             name: 'role',
             value: $("#role").val()
                }],

        buttons: [{
            text: '保存',
			handler: function(b,e){
				if (top.form.isValid()) {
				
				    
					if (/^(&nbsp;)+$/.test((Ext.util.Format.stripTags(top.get('appercetionBody').getValue())).trim() )
					|| top.get('appercetionBody').getValue().trim() =='' || Ext.get('appercetionTitle').getValue().trim()== '') {
						Ext.Msg.alert('','标题或者心得记录不能为空白');
						return;
					}
					top.form.submit();
				}
				
			}
        },{
            text: '取消',
            type: 'reset',
            handler: function(){
            	top.form.reset();
            }
        }]
    });

    top.render(Ext.fly("editor"));	
				
				
				}
				
				
				);
			
			
			});
			
			
			
			
			
		
						
			</script>

</head>
<body>
<body
	style="
	background: url(<%=basePath%>img/bg.jpg) -200px -83px;
	background-attachment: fixed;">

<div id="editor" style="margin: 0 auto; width: 939px; margin-top: 80px">

<input type="hidden" id="appercetionID" value="${param.appercetionID }">
<input type="hidden" id="role" name="role" value="${param.role }">
</div>

</body>



</html>
